﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using InformationSystem.BLL.Core.Model;
using InformationSystem.BLL.Core.Dao;
using InformationSystem.BLL.Core.Dao.Impl;

namespace InformationSystem.BLL.Core.Service.Impl
{
    public class CollegeServiceImpl : ICollegeService
    {
        public ICollegeDao CollegeDao { get; set; }


        public IList<College> GetAllCollegeInfo()
        {
            return CollegeDao.GetAllCollegeInfo();

        }

        public bool UpdateCollegeInfo(College college)
        {
            return CollegeDao.UpdateCollegeInfo(college);
        }


        public IList<ClassInfo> GetClassInfoByAss(LoginUser user)
        {
            if (user.LoginUserType == UserType.Assistant)
                return CollegeDao.GetClassInfoByAss(user);
            return null;
        }

        public bool CreateClassInfo(ClassInfo newclass, LoginUser user)
        {
            if (user.LoginUserType != UserType.Assistant) return false;
            return CollegeDao.CreateClassInfo(newclass, user);
        }

        public bool DeleteClassInfoByID(string classid, LoginUser user)
        {
            if (user.LoginUserType == UserType.Assistant)
                return CollegeDao.DeleteClassInfoByID(classid, user);
            return false;
        }

        public bool UpdateClassInfo(ClassInfo classinfo, LoginUser user)
        {
            if (user.LoginUserType != UserType.Assistant) return false;
            return CollegeDao.UpdateClassInfo(classinfo, user);
        }

        public ClassInfo GetClassInfo(string classid)
        {
            return CollegeDao.GetClassInfo(classid);
        }


        public College GetCollegeInfo(int collegeid)
        {
            return CollegeDao.GetCollegeInfo(collegeid);
        }
    }
}
